package com.example.makerspace.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.makerspace.domain.TaskTagDO;
import com.example.makerspace.mapper.TaskTagMapper;
import com.example.makerspace.vo.TaskTagsVO;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

@Component
public class TaskTagDAO extends BaseDAO<TaskTagDO> {
    @Resource
    private TaskTagMapper taskTagMapper;

    @PostConstruct
    public void init(){
        this.mapper = taskTagMapper;
    }

    public List<TaskTagsVO> selectByJoin(String username) {
        return  taskTagMapper.selectByJoin(username);
    }

    public TaskTagDO selectByProductTaskName() {
        QueryWrapper<TaskTagDO> wrapper = new QueryWrapper<>();
        wrapper.eq("task_type","上架产品");
        return mapper.selectOne(wrapper);
    }

    public TaskTagDO selectByUserTaskName() {
        QueryWrapper<TaskTagDO> wrapper = new QueryWrapper<>();
        wrapper.eq("task_type","个人认证");
        return mapper.selectOne(wrapper);
    }

    public TaskTagDO selectByEntTaskName() {
        QueryWrapper<TaskTagDO> wrapper = new QueryWrapper<>();
        wrapper.eq("task_type","企业认证");
        return mapper.selectOne(wrapper);
    }
}
